﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using Microsoft.Phone.Controls;
using MetroGoogle.External.Google;
using System.Diagnostics;

namespace GoogleExample
{
    public partial class MainPage : PhoneApplicationPage
    {
        GoogleClient client;
        const string kScope = "";
        // Constructor
        public MainPage()
        {
            InitializeComponent();
            if(String.IsNullOrEmpty(AppKeys.kGoogleAppKey) || String.IsNullOrEmpty(AppKeys.kGoogleAppSecret))
                throw new NotImplementedException("You need to add your keys");

            client = new GoogleClient(AppKeys.kGoogleAppKey, AppKeys.kGoogleAppSecret, kScope);
        }
        private void clickMeButton_Click(object sender, RoutedEventArgs e)
        {
            Auth();
        }

        private async void Auth()
        {
            var result = await client.AuthorizeAsync("http://jaykimble.net");
            Debug.WriteLine("Authd: " + result);
        }
    }
}